<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/WEB-INF/templates/template.xhtml">
	<ui:define name="title">
	</ui:define>

	<ui:define name="content">
		<h:form prependId="false">
			<p:wizard widgetVar="wiz" showStepStatus="false" showNavBar="false"
				flowListener="#{gradeHorariaController.onFlowProcess}">

				<p:tab id="versaoName">

					<p:panel header="Crição da Grade">

						<h:messages errorClass="error" />

						<h:panelGrid columns="2" columnClasses="label, value"
							styleClass="grid">
							<h:outputText value="Nome da Versao*:" />
							<p:inputText required="true" label="Nome da Versao"
								value="#{gradeHorariaController.gradeHorariaVO.nome}" />

						</h:panelGrid>
					</p:panel>
				</p:tab>

				<p:tab id="InserirData">
					<p:panel header="Crição dos horarios">
					
						<h:panelGrid columns="5" columnClasses="label, value"
							styleClass="grid" >
							<h:outputText value="Insira os horários iniciais das aulas:" />
			
							<h:selectOneMenu id="hora" value="#{gradeHorariaController.hora}">
								<f:selectItems value="#{gradeHorariaController.listaDeHoras}" />
							</h:selectOneMenu>
			
							<h:outputText value=":" />
			
							<h:selectOneMenu id="minuto"
								value="#{gradeHorariaController.minuto}">
								<f:selectItems value="#{gradeHorariaController.listaDeMinutos}" />
							</h:selectOneMenu>
			
							<p:commandButton value="Adicionar"
								action="#{gradeHorariaController.addHorario}"
								update="returnBuscaGrade"></p:commandButton>
						</h:panelGrid>
			
						<h:panelGroup id="returnBuscaGrade">
							<p:dataTable var="horario"
								value="#{gradeHorariaController.listaHora}" rendered="#{!empty gradeHorariaController.listaHora}" >
								
								<f:facet name="header">
									<h:outputText value="Tabela de Dias e Horarios da grade" />
								</f:facet>
			
								<p:column>
									<f:facet name="header">
										<h:outputText value="Horarios/Dias" />
									</f:facet>
									<h:outputText value="#{horario.hora} : #{horario.minutos}" />
								</p:column>
								<p:column style="align:center;">
									<f:facet name="header">
										<h:outputText value="Segunda"/>
									</f:facet>  
					            	<h:outputText value="-" />
								</p:column>
								<p:column>
									<f:facet name="header">
										<h:outputText value="Terça"/>
									</f:facet>  
					            	<h:outputText value="-" />
								</p:column>
								<p:column>
									<f:facet name="header">
										<h:outputText value="Quarta"/>
									</f:facet>  
					            	<h:outputText value="-" />
								</p:column>
								<p:column>
									<f:facet name="header">
										<h:outputText value="Quinta"/>
									</f:facet>  
					            	<h:outputText value="-" />
								</p:column>
								<p:column>
									<f:facet name="header">
										<h:outputText value="Sexta"/>
									</f:facet>  
					            	<h:outputText value="-" />
								</p:column>
								<p:column>
									<f:facet name="header">
										<h:outputText value="Sabado"/>
									</f:facet>  
					            	<h:outputText value="-" />
								</p:column>
								
								<p:column style="width:32px">
									<f:facet name="header">
										<h:outputText value="Remover"/>
									</f:facet>
									
									<p:commandButton update="display,returnBuscaGrade" oncomplete="confirmation.show()"
										image="ui-icon ui-icon-close">
										<f:setPropertyActionListener value="#{horario}"
											target="#{gradeHorariaController.horaVOAux}" />
									</p:commandButton>
									
								</p:column>
								<f:facet name="footer">
								</f:facet>
							</p:dataTable>
							<p:commandButton value="Salvar"  action="#{gradeHorariaController.salvar}"  styleClass="button" ajax="false" />
							
						</h:panelGroup>
					</p:panel>
				</p:tab>
				</p:wizard>
				<p:commandButton value="Continuar"   styleClass="button"  onclick="wiz.next();" />
				<p:confirmDialog message="Tem certeza que deseja excluir este Horario?"
								showEffect="explode" hideEffect="explode" modal="true"
								header="Excluir Horario" severity="alert" widgetVar="confirmation">
						<h:panelGrid id="display" columns="3" cellpadding="4">
							<h:outputText value="Horario:" />
							<h:outputText value="#{gradeHorariaController.horaVOAux.hora} : #{gradeHorariaController.horaVOAux.minutos}" />
						</h:panelGrid>
						<p:commandButton value="Sim"  oncomplete="confirmation.hide()"
									action="#{gradeHorariaController.removerHorario}" update="returnBuscaGrade" />
						<p:commandButton value="Não" onclick="confirmation.hide()" type="button" /> 
				</p:confirmDialog>
				
		</h:form>
	</ui:define>
</ui:composition>
